<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1, shrink-to-fit=no">
<meta name="description" content="">
<meta name="author" content="">

<title>Dashboard Template for Bootstrap</title>

<!-- Bootstrap core CSS -->
<link href="/web/libs/bootstrap/4.0/css/bootstrap.min.css" rel="stylesheet">

<!-- Custom styles for this template -->
<link href="/web/libs/bootstrap/4.0/css/dashboard.css" rel="stylesheet">
	<link rel="stylesheet" href="bootstrap-table.css">
</head>

<body>
	<div id="header"></div>
	<div class="container-fluid">
		<div class="row">
			<div id="menu"></div>
			<main class="col-sm-9 offset-sm-3 col-md-10 offset-md-2 pt-3">
			<div class="container">
					<div class="input-group">
						查询日期：<input type="text" class="form-control" id="queryDate" value="20200202">
						开始日期：<input type="text" class="form-control" id="startDate" value="20190101">
						结束日期：<input type="text" class="form-control" id="endDate" value="20200201">
						新高的涨幅范围:<input type="text" class="form-control" id="recordLevelsRange" value="8">
						排序包含250线：<input type="checkbox" checked="checked" class="form-control" id="sortBy250" value="true">
					</div>
					<div class="input-group">
						需要倒数N天的数据：<input type="text" class="form-control" id="backNdays" value="5">
						剔除最近N天：<input type="text" class="form-control" id="excludeNearNdays" value="7">
						强制执行：<input type="checkbox" class="form-control" id="forceJob" value="false">
						概念关键字：<input type="text" class="form-control" id="conceptName" value="">
						<span lass="input-group-btn"> <button class="btn btn-default" type="button" id="queryAction">Go!</button> </span>
						<span lass="input-group-btn"> <button class="btn btn-default" type="button" id="downAction">Download!</button> </span>
					</div>

				</div>
				
			<div id="rptList" style="width: 100%; hight: 100%; float: left；">
				<table class="table table-hover" id="cusTable">
				</table>
			</div>
			</main>
		</div>
	</div>

	<!-- Bootstrap core JavaScript
    ================================================== -->
	<!-- Placed at the end of the document so the pages load faster -->
	<script src="/web/libs/js/jquery-3.1.1.slim.min.js"
		integrity="sha384-A7FZj7v+d/sdmMqp/nOQwliLvUsJfDHW+k9Omg/a/EheAdgtzNs3hpfag6Ed950n"
		crossorigin="anonymous"></script>
	<script src="/web/libs/js/tether.min.js"
		integrity="sha384-DztdAPBWPRXSA/3eYEEUWrWCy7G5KFbe8fFjk5JAIxUYHKkDx6Qin1DkWx51bBrb"
		crossorigin="anonymous"></script>
	<script src="/web/libs/bootstrap/4.0/js/bootstrap.min.js"></script>
	<script src="/web/libs/js/common.js"></script>
	<script src="/web/libs/js/jquery.js"></script>
	<script src="/web/libs/js/dashboard/index.js"></script>
	<script src="/web/libs/bootstrap/4.0/js/bootstrap-table.js"></script>
	<script src="/web/libs/js/dashboard/basedata.js"></script>
	<script type="text/javascript">
		$("#header").load("/web/header.html")
		addActive("m_recordLevels");
		$('#cusTable').bootstrapTable('destroy');
		$('#queryDate').val(new Date().format("yyyyMMdd"));
		$('#endDate').val(new Date().format("yyyyMMdd"));

		function loadData() {
			$('#cusTable').bootstrapTable('destroy');
			$("#cusTable").bootstrapTable(
					{
						method : "get", //使用get请求到服务器获取数据  
						url : "/web/recordLevels/recordLevelsQuery", //获取数据的Servlet地址
						striped : true, //表格显示条纹  
						pagination : true, //启动分页
						cache : false,
						pageSize : 500, //每页显示的记录数
						//pageNumber:1, //当前第几页  
						pageList : [ 10, 150, 500, 500 ], //记录数可选列表
						search : false, //是否启用查询
						sortable: true,                     //是否启用排序
						sortOrder: "asc",                   //排序方式
						//showColumns: true,  //显示下拉框勾选要显示的列  
						//showRefresh: true,  //显示刷新按钮  
						sidePagination : "server", //表示服务端请求
						//设置为undefined可以获取pageNumber，pageSize，searchText，sortName，sortOrder  
						//设置为limit可以获取limit, offset, search, sort, order  
						queryParamsType : "undefined",
						queryParams : function queryParams(params) { //设置查询参数  
							var queryDate = $('#queryDate').val();
							var startDate = $('#startDate').val();
							var endDate = $('#endDate').val();
							var range = $('#range').val();
							var code = $('#code').val();
							var forceJob = $('#forceJob').is(":checked");
							var sortBy250 = $('#sortBy250').is(":checked");
							var recordLevelsRange = $('#recordLevelsRange').val();
							var backNdays = $('#backNdays').val();
							var excludeNearNdays = $('#excludeNearNdays').val();
							var conceptName = $('#conceptName').val();

							var param = {
								pageNum : params.pageNumber,
								pageSize : params.pageSize,
								sortName : params.sortName,      //排序列名
								sortOrder : params.sortOrder //排位命令（desc，asc）
							};
							param.queryDate = queryDate;
							param.startDate = startDate;
							param.endDate = endDate;
							param.range = range;
							param.code = code;
							param.forceJob = forceJob;
							param.sortBy250 = sortBy250;
							param.recordLevelsRange = recordLevelsRange;
							param.backNdays = backNdays;
							param.excludeNearNdays = excludeNearNdays;
							param.conceptName = conceptName;
							return param;
						},
						columns : [ {
							field : 'code',
							title : '股票代码',
						}, {
							field : 'name',
							title : '名称',
						}, {
							field : 'queryDate',
							title : '查询时间',
						}, {
							field : 'moreThanMa250Count',
							title : '超过250日线的量',
							sortable : true,
						}, {
							field : 'whichDayUp',
							title : '第几天突破',
							sortable : true,
						}, {
							field : 'conceptName',
							title : '相关概念',
						}],
						responseHandler : function responseHandler(res) {
							
							var s1 = JSON.stringify(res.result);
							var s2 = '{"total":9999,"rows":' + s1 + '}';
							//alert(s2);
							return eval('(' + s2 + ')')
						},
						onLoadSuccess : function() { //加载成功时执行
							$("#rptList").show();
						},
						onLoadError : function() { //加载失败时执行  
							alert("加载数据失败");
						}
					});
		}
		
		$("#queryAction").click(function() {
				//alert("abc");
				loadData()
		});
		$("#downAction").click(function () {
			window.location.href="/web/recordLevels/download?"
					+ "queryDate="+ $('#queryDate').val()
					+ "&startDate="+ $('#startDate').val()
					+ "&endDate="+ $('#endDate').val()
					+ "&range="+ $('#range').val()
					+ "&code="+ $('#code').val()
					+ "&forceJob="+ $('#forceJob').is(":checked")
					+ "&sortBy250="+ $('#sortBy250').is(":checked")
					+ "&recordLevelsRange="+ $('#recordLevelsRange').val()
					+ "&backNdays="+ $('#backNdays').val()
					+ "&excludeNearNdays="+ $('#excludeNearNdays').val()
					+ "&conceptName="+ $('#conceptName').val()
		});
		loadData();
	</script>
</body>
</html>
